﻿using System.Collections.Generic;
using System.Threading.Tasks;

namespace WPFNote.Services
{
    public class Category : ServiceBasic<Models.Category, Models.CategorySch>, IDal.ICategory
    {
        private readonly Repository.IDal.ICategory _dal;
        public Category(Repository.IDal.ICategory dal)
        {
            base.Dal = dal;
            _dal = dal;
        }

        public void CreateTable()
          { 
            _dal.CreateTable();
        }

        /// <summary>
        /// 自定义条件查询列表-直接执行Sql语句-查询分类列表，并携带博客数量
        /// </summary>
        /// <param name="ts"></param>
        /// <returns></returns>
        public async Task<List<Models.Category>> SelectListIncludeBlogNumAsync(Models.CategorySch ts)
        {
            return await _dal.SelectListIncludeBlogNumAsync(ts);
        }


        /// <summary>
        /// 自定义条件查询列表-直接执行Sql语句-查询分类列表，并携带笔记数量
        /// </summary>
        /// <param name="ts"></param>
        /// <returns></returns>
        public async Task<List<Models.Category>> SelectListIncludeNoteNumAsync(Models.CategorySch ts)
        {
            return await _dal.SelectListIncludeNoteNumAsync(ts);
        }
    }
}
